package web.base.user.message;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import web.base.user.dict.UserState;
import web.base.user.validation.LoginGroup;
import web.base.user.validation.RegisterGroup;
import web.common.core.validation.annotation.FieldEqual;
import web.common.core.validation.annotation.Mobile;
import web.common.core.validation.group.GetGroup;
import web.common.core.validation.group.UpdateGroup;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;

/**
 * @author Jin Zheng
 * @since 2022-01-03
 */
@Getter
@Setter
@NoArgsConstructor
@FieldEqual(groups = {RegisterGroup.class}, fields = {"password", "password2"}, message = "2次密码不一致")
public class UserRequest {
	@NotNull(groups = {GetGroup.class, UpdateGroup.class}, message = "用户ID不能为空")
    private Integer id;

	@NotEmpty(groups = {RegisterGroup.class, LoginGroup.class}, message = "用户手机号码不能为空")
	@Mobile(groups = {RegisterGroup.class, LoginGroup.class}, message = "用户手机号码格式错误")
	private String mobile;

	@NotEmpty(groups = {RegisterGroup.class}, message = "用户名称不能为空")
	private String name;

	@NotEmpty(groups = {RegisterGroup.class, LoginGroup.class}, message = "用户密码不能为空")
	private String password;

	@NotEmpty(groups = {RegisterGroup.class}, message = "用户密码2不能为空")
	private String password2;
	private UserState state;

}
